<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of histc2</title>
  <meta name="keywords" content="histc2">
  <meta name="description" content="Multidimensional histogram count with weighted values.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html images -->
<h1>histc2
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Multidimensional histogram count with weighted values.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function h = histc2( A, edges, wtMask ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Multidimensional histogram count with weighted values.

 Creates a histogram h of the values in A [n x nd], with edges as
 specified. If nd==1, that is when A is a vector, the resulting histogram
 h is a vector of length nBins, where nBins=length(edges)-1. h(q) contains
 the weighted count of values v in A such that edges(q) &lt;= v &lt; edges(q+1).
 h(nBins) additionally contains the weighted count of values in A such
 that v==edges(nBins+1) -- which is different then how histc treates the
 boundary condition. Finally, h is normalized so that sum(h(:))==1.

 It usually makes sense to specify edges explicitly, especially if
 different histograms are going to be compared.  In general, edges must
 have monotonically non-decreasing values.  Also, if the exact bounds are
 unknown then it is convenient to set the first element in edges to -inf
 and the last to inf.  If h = histc2( A, nBins, ...), edges are
 automatically generated and have bins equally spaced between min(A) and
 max(A). That is the edges vector is generated by:
  edges = linspace( min(A)-eps, max(A)+eps, nBins+1 );

 If nd&gt;1, that is when A is a 2d matrix instead of a vector, the created
 histogram is multi-dimensional with dimensions nBins^nd, where each bin
 h(q1,...,qnd) contains the the weighted count of vectors v in A such that
 edges{k}(qk) &lt;= v(k) &lt; edges{k}(qk+1), for k=1,...,nd.  Note that if nd&gt;1
 edges may be a cell vector where each element is a vector of edges or a
 scalar nBins as before.

 Each value in A may optionally have an associated weight given by wtMask,
 which should have the same number of elements as A. If not specified, the
 default is wtMask=ones(n,1).

 USAGE
  h = histc2( A, edges, [wtMask] )

 INPUTS
  A           - [n x nd] 2D numeric array
  edges       - quantization bounds, see above
  wtMask      - [] length [n] vector of weights

 OUTPUTS
  h           - nd histogram [nBins^nd]

 EXAMPLE - 1D histograms
  A=filterGauss([1000 1000],[],[],0); A=A(:); n=length(A);
  h1 = histc2( A, 25 );              figure(1); bar(h1);
  h2 = histc2( A, 25, ones(n,1) );   figure(2); bar(h2);
  h3 = histc2( A, 25, A );           figure(3); bar(h3);

 EXAMPLE - 2D histograms
  A=filterGauss([1000 1000],[],[],0); A=A(:); n=length(A);
  h=histc2( [A A], 25 );    figure(1); im(h);  % decreasing along diag
  h=histc2( [A A], 25, A ); figure(2); im(h);  % constant along diag

 See also HISTC, <a href="assignToBins.html" class="code" title="function B = assignToBins( A, edges )">ASSIGNTOBINS</a>, BAR

 Piotr's Computer Vision Matlab Toolbox      Version 2.0
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]</pre></div>





<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
